import { checkTokenExpired } from '@/utils/auth'

// 定义不需要验证token的页面路径
const excludePages = ['pages/login/login', 'pages/register/register']

export default {
  onShow() {
    // 获取当前页面路径
    const pages = getCurrentPages()
    const currentPage = pages[pages.length - 1]
    const route = currentPage?.route || ''

    // 如果当前页面不在排除列表中，则验证token
    if (!excludePages.includes(route)) {
      checkTokenExpired()
    }
  },
}
